package com.wanpinghui.supplier.widgets;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.inputmethod.InputMethodManager;
import android.widget.LinearLayout;

/***
 * 功能描述:
 * 作者:qiujialiu
 * 时间:2017/12/18
 ***/

public class MessageP2PLayout extends LinearLayout {
    public MessageP2PLayout(Context context) {
        super(context);
    }

    public MessageP2PLayout(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public MessageP2PLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        if (ev.getAction() == MotionEvent.ACTION_DOWN) {
            InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
        }
        return super.dispatchTouchEvent(ev);
    }
}
